package cn.tedu.egmybatis1.mapper;


import cn.tedu.egmybatis1.pojo.entity.Product;
import cn.tedu.egmybatis1.pojo.vo.SelectProductVO1;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper {
//    @Insert("INSERT INTO product(title,price,stock) VALUES " +
//            "(#{title},#{price},#{stock})")
    void insertProduct(Product product);

    //@Select("SELECT id,title,price,stock FROM product WHERE id = #{productId}")
    Product selectProduct(Long productId);

    //@Delete("DELETE FROM product WHERE id = #{productId}")
    int deleteProduct(Long productId);

    //@Select("SELECT id,title,price,stock FROM product")
    List<Product> selectProducts();

    //@Select("SELECT title,price FROM product WHERE id = #{productId}")
    SelectProductVO1 selectProductVO1(Long productId);

}
